<?php

namespace app\shop\controller;

class Deal extends Base
{
	// 糖果机列表 candy machine
	public function cmlist()
	{
		$map = [];
		if (is_get()) {
			if (input('get.keywords')) {
				$map['name|tel'] = ['like', '%'.input('get.keywords').'%'];
			}
			if (is_numeric(input('get.status'))) {
				$map['candy_marchine.status'] = input('get.status');
			}
			if (input('get.uid')) {
				$map['candy_marchine.uid'] = input('get.uid');
			}
			if (input('get.type')) {
				$map['candy_marchine.type'] = input('get.type');
			}
		}

		$list  = model('CandyMachine')->getList($map);

		$this->assign('cmType', db('candym_type')->field('id,type_name')->select());
		$this->assign('list', $list);

		return $this->fetch();
	}

	// 代理充值
	public function dlChong()
	{	
		$map = [];

		if (is_get()) {
			if (input('get.uid')) {
				$map['uid'] = input('get.uid');
			}
			if (input('get.dl')) {
				$map['dl_id'] = input('get.dl');
			}
			if (input('get.status')) {
				$map['status'] = input('get.status');
			}
		}

		$list  = model()->getList($map);
		$this->assign('list', $list);

		return $this->fetch();
	}

	// 玩家转账
	public function zhuan()
	{
		$map = [];
		if (is_get()) {
			if (input('get.uid')) {
				$map['uid'] = input('get.uid');
			}
			if (input('get.status')) {
				$map['status'] = input('get.status');
			}
		}

		$list = model()->getList($map);
		$this->assign('list', $list);

		return $this->fetch();
	}

	// 卖出记录
	public function sellList()
	{
		$map = [];
		if (is_get()) {
			if (input('get.uid')) {
				$map['uid'] = input('get.uid');
			}
			if (input('get.status')) {
				$map['status'] = input('get.status');
			}
		}

		$list = model()->getList($map);
		$this->assign('list', $list);

		return $this->fetch();
	}

	// 买入记录
	public function buyList()
	{
		$map = [];
		if (is_get()) {
			if (input('get.uid')) {
				$map['uid'] = input('get.uid');
			}
			if (input('get.status')) {
				$map['status'] = input('get.status');
			}
		}

		$list = model()->getList($map);
		$this->assign('list', $list);

		return $this->fetch();
	}
	
}
